package com.powernode.springboot.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

//纳入IOC容器管理
//@Component
//指定配置的属性前缀
//myapp:
//  username: zhangsan
//  age: 20
//  gender: true
@ConfigurationProperties(prefix = "myapp")
public class AppConfig {
    private String username;
    private Integer age;
    private boolean gender;

    //需要设置set方法，底层调用的set方法赋值
    public void setUsername(String username) {
        this.username = username;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public void setGender(boolean gender) {
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "AppConfig{" +
                "username='" + username + '\'' +
                ", age=" + age +
                ", gender=" + gender +
                '}';
    }
}
